#include "BaseBody.h"

BaseBody::BaseBody(b2World *_World, b2BodyType _BodyStype)
{
	mWorld = _World;
	mBodyStype = _BodyStype;
}


BaseBody::~BaseBody()
{
}

void BaseBody::setPosition(b2Vec2 _Position)
{
	mShaBody->SetTransform(b2Vec2((float)_Position.x / Define::PTM_RATIO, (float)_Position.y / Define::PTM_RATIO), mShaBody->GetAngle());
	mColBody->SetTransform(mShaBody->GetPosition(), mShaBody->GetAngle());
}

void BaseBody::setAngle(float _Angle)
{
	mShaBody->SetTransform(mShaBody->GetPosition(), _Angle);
	mColBody->SetTransform(mShaBody->GetPosition(), mShaBody->GetAngle());
}

void BaseBody::setTransform(b2Vec2 _Position, float _Angle)
{
	mShaBody->SetTransform(b2Vec2((float)_Position.x / Define::PTM_RATIO, (float)_Position.y / Define::PTM_RATIO), _Angle);
	mColBody->SetTransform(mShaBody->GetPosition(), mShaBody->GetAngle());
}

float BaseBody::getAngle()
{
	return mShaBody->GetAngle();
}

void BaseBody::makeBody()
{

}

b2Vec2 BaseBody::getPosition()
{
	return b2Vec2(mShaBody->GetPosition().x * Define::PTM_RATIO, mShaBody->GetPosition().y * Define::PTM_RATIO);
}

void BaseBody::setActive(bool active)
{
	mShaBody->SetActive(active);
	mColBody->SetActive(active);
}
